<?php
/**
* （6W1303）单笔代发代扣交易
* 建行跨行转账 可以转账到信用卡
*/
class Conf6w1303 extends Abccbconf
{
    public function getTransaction()
    {
        $this->_ccbConf->getTransactionHeader();
        $this->_ccbConf->getTransactionSign();
    }

    public function getTransactionBody()
    {
        /**
         * 本方企业账户 varChar(32)
         */
        $body['ACC_NO1'] = $this->payAccNo;

        /**
         * 代发代扣编号 varChar(20) F 同网银代发代扣编号
         */
        $body['BILL_CODE'] = $this->billCode;

        /**
         * 对方账户 varChar(32)
         */
        $body['ACC_NO2'] = $this->parameter['ACC_NO2'];

        /**
         * 对方姓名 varChar(60)
         */
        $body['OTHER_NAME'] = $this->parameter['OTHER_NAME'];

        /**
         * 金额 Decimal(16,2) 
         */
        $body['AMOUNT'] = $this->parameter['AMOUNT'];

        /**
         *  用途编号 varChar(12) 
         */
        $body['USEOF_CODE'] = $this->useofCode;

        /**
         * 网银审批标识 Char(1) T 空或0.不需审批  1.网银审批
         */
        $body['FLOW_FLAG'] = isset($this->parameter['FLOW_FLAG']) ? $this->parameter['FLOW_FLAG'] : 0;

        /**
         *  对方账户支付系统行号 varChar(20) T 大小额跨行代发交易时，此栏位必填
         */
        $body['UBANK_NO'] = $this->parameter['UBANK_NO'];

        /**
         *  备注1 varChar(32) 
         */
        $body['REM1'] = isset($this->parameter['REM1']) ? $this->parameter['REM1'] : '';

        /**
         *  备注2 varChar(32) 
         */
        $body['REM2'] = isset($this->parameter['REM2']) ? $this->parameter['REM2'] : '';
        return $body;
    }

    public function validateParameter()
    {
        if ( empty($this->parameter['ACC_NO2']) ) {
            throw new Exception("请输入对方账户", 1);
        }

        if ( empty($this->parameter['OTHER_NAME']) ) {
            throw new Exception("请输入对方姓名", 1);
        }

        if ( empty($this->parameter['UBANK_NO']) ) {
            throw new Exception("对方账户支付系统行号", 1);
        }

        if ( $this->parameter['AMOUNT'] <= 0 ) {
            throw new Exception("转账金额必须大于0", 1);
        }
    }
}